package com.baosight.scaq.aq.ci.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.scaq.aq.ci.domain.AQCIHistoryPersonInfo;
/**
 * 下井人员历史查询
 */
public class ServiceAQCI60 extends ServiceEPBase {
	/**
	 * <p>Function: initLoad</p>
	 * <p>Description: 初始化</p> 
	 */
	@Override
	public EiInfo initLoad(EiInfo inInfo) {
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		inInfo=this.query(inInfo);
		return inInfo;
	}
	
	/**
	 * 
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCI60</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2017-3-22 00:08:17 李红星
	 * </p>
	 *
	 */
	@Override
	public EiInfo query(EiInfo inInfo) {
//		String fdMineId = UserSession.getInSessionProperty("miningCode").toString();
		EiInfo outInfo = new EiInfo();
//		StaticTools.setQueryParameters(inInfo, "fdMiningId", fdMineId, true);// 添加查询条件
		outInfo = super.query(inInfo, "AQCIHistoryPersonInfo.query", new AQCIHistoryPersonInfo());
		outInfo.addBlock(getMines());
		return outInfo;
	}
	
	
	/**
	 * 矿井block
	 * @return
	 */
	private EiBlock getMines() {
		// TODO Auto-generated method stub
		EiBlock block = new EiBlock("cmes.ch.mine");

		EiColumn EiColumn = new EiColumn("display");
		EiColumn.setType("C");
		block.addMeta(EiColumn);

		EiColumn = new EiColumn("value");
		EiColumn.setType("C");
		block.addMeta(EiColumn);

		List<Map> _list = new ArrayList<Map>();
		Map<String, String> _map = new HashMap<String, String>();
		_map.put("value", "");
		_map.put("display", "");
		_list.add(_map);

		List<Map> _listData = new ArrayList<Map>();
		try {
			_listData = dao.query("AQCIEquipmentInfo.queryTreeChild", null);
		} catch (Exception e) {}
		
		for(int i = 0; i < _listData.size(); i++) {
			_list.add(_listData.get(i)); 
		} 
		block.setRows(_list);
		return block;
	}
	
	
	
	
} 